<template>
    <div>
      <div class="common_bg_fff drawBOX">
        <p class="font_333_30">提取金额</p>
        <div class="moneyBOX">
          <span class="font_141414_50">￥</span>
          <input type="number" class="font_141414_80" v-model="T_money">
        </div>
        <p class="tipBOX">
          <span class="font_999_24">零钱余额￥{{allyue}},</span>
          <span class="font_62C5F0_24" @click="T_draw(1)">全部提现</span>
        </p>
      </div>

      <p class="font_999_24 emm">提现到</p>

      <div class="common_bg_fff">
        <div class="drawType">
          <i class="inlineBlockIcon weixin"></i>
          <span class="font_333_28">微信</span>
        </div>
      </div>

      <!--btn-->
      <div class="btn font_fff_36" @click="T_draw(0)">提现</div>

      <toast v-model="showPositionValue" type="text" :time="1500" is-show-mask :text="showPositionValueTEXT" position="middle"></toast>
    </div>
</template>

<script>
  import { Toast } from 'vux'
    export default {
        name: '',
        components: {
          Toast
        },
        data() {
            return {
              title:'零钱提现',
              allyue:0,
              T_money:0,
              showPositionValueTEXT:'',
              showPositionValue:false
            }
        },
        created () {
          this.setTitle(this.title)
        },
        mounted: function () {
          this.axios.post('/home/Recharge/appearCash',{token:this.$store.state.token}).then((res)=>{
            if(res.data.code==200){
              this.allyue = res.data.data
            }
          })
        },
        methods: {
          T_draw(type){
            if(type==1){
              this.T_money = this.allyue
              return
            }
            if(Number(this.T_money)<1){
              this.showPositionValue = true
              this.showPositionValueTEXT = '提现金额不得小于1元'
              return
            }
            this.axios.post('/home/Recharge/toCash',{
              token:this.$store.state.token,
              cash: this.T_money
            }).then((res)=>{
              if(res.data.code==200){
                this.$router.push('/wallet')
              }
            })
          }
        }
    }
</script>

<style scoped>
  @import "../../assets/public.css";
  @import "//at.alicdn.com/t/font_814275_a49o0xc0z4m.css";

  .drawBOX{
    width:6.92rem;
    height:2.8rem;
    border-radius: .08rem;
    margin:.2rem auto;
    padding:.46rem .4rem 0 .4rem;
    box-sizing: border-box;
  }
  .moneyBOX{
    border-bottom: 1px solid #E6E6E6;
    display: flex;
    align-items: center;
    height:1.53rem;
    overflow: hidden;
  }
  .moneyBOX>input{
    padding-left: .25rem;
  }
  .tipBOX{
    height:.52rem;
    line-height: .52rem;
  }
  .emm{
    width:6.92rem;
    margin:.3rem auto .17rem;
  }
  .drawType{
    height: 1rem;
    width:6.92rem;
    margin:.3rem auto .17rem;
    display: flex;
    align-items: center;
  }
  .weixin{
    width:.45rem;
    height:.45rem;
    background-image: url("img/wx.png");
    margin-right:.21rem;
  }
  .btn{
    width:6.92rem;
    height:.88rem;
    background:#28ac4f; /* 一些不支持背景渐变的浏览器 */
    background: -webkit-linear-gradient(right, #28ac4f, #3aab5c); /* Safari 5.1 - 6.0 */
    background: -o-linear-gradient(right, #28ac4f, #3aab5c); /* Opera 11.1 - 12.0 */
    background: -moz-linear-gradient(right, #28ac4f, #3aab5c); /* Firefox 3.6 - 15 */
    background: linear-gradient(right, #28ac4f, #3aab5c); /* 标准的语法 */
    text-align: center;
    line-height: .88rem;
    margin: 1.45rem auto 0;
    border-radius: 5px;
  }
</style>
